package com.myk.game.heroscuffle.heroes;

import com.myk.game.heroscuffle.data.HeroParam;
import com.myk.game.heroscuffle.game.Element;
import com.myk.game.heroscuffle.game.Hero;

public class Hero_XiaZhan extends Hero {

    public Hero_XiaZhan() {
        super("遐战",
                "攻击后增加攻击力，被攻击后增加防御力，击杀后重置行动状态。",
                Element.WIND,
                1220, 125, 42);
    }

    @Override
    public void onAfterDoAttack(Hero attacked, int damage, boolean isToDeath) {
        final int addAtk = 5;
        atk += addAtk;
        game.ui.printMsg(getObviousName() + "刀锋磨砺atk增加" + addAtk + ",当前" + atk + "点。");
        game.ui.sleepShortly();
        if (isToDeath) {
            this.clearActioned();
            game.ui.printMsg(getObviousName() + "战意不止，回合内可再次行动。");
            game.ui.sleepShortly();
        }
    }

    @Override
    public void onAfterBeAttack(Hero attacker, int damage) {
        final int defAdd = 2;
        if (def + defAdd < HeroParam.DEF_MAX_LIMIT) {
            def += defAdd;
            game.ui.printMsg(getObviousName() + "百炼成钢def增加" + defAdd + ",当前" + def + "点。");
            game.ui.sleepShortly();
        }
        else {
            int lastDefAdd = HeroParam.DEF_MAX_LIMIT - def;
            if (lastDefAdd > 0) {
                def += lastDefAdd;
                game.ui.printMsg(getObviousName() + "百炼成钢def增加" + lastDefAdd + ",当前" + def + "点(已达上限)。");
                game.ui.sleepShortly();
            }
        }
    }
}
